package com.csdj.utils;
import java.util.Calendar;

public class DateUtil {

    public static long getRemainderSecond(){
        //获取当前秒数
        //1970到现在的毫秒数
        long curInMillis = System.currentTimeMillis();
        //需要计算当天晚上24点的秒数
        //
        Calendar calendar = Calendar.getInstance();
        //日期添加一天
        calendar.add(Calendar.DAY_OF_YEAR,1);
        //小时, 分钟数, 秒数 设置为 0;
        calendar.set(Calendar.HOUR_OF_DAY,0);
        calendar.set(Calendar.SECOND,0);
        calendar.set(Calendar.MILLISECOND,0);
        //晚上24点的时间戳 ,获取时间戳
        final long timeInMillis = calendar.getTimeInMillis();
        return (timeInMillis-curInMillis)/1000 ;


    }

    public static void main(String[] args) {
        System.out.println(getRemainderSecond());
    }


}
